<!-- TWO STEPS TO INSTALL THIS SCRIPT -->

<!-- STEP ONE: Place the following script into a separate JavaScript file called: calendar.js	 -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

function getCalendar(year, month) {

//  SET ARRAYS
var day_of_week = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
var month_of_year = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

//  DECLARE AND INITIALIZE VARIABLES
var Calendar = new Date();

var ayear = Calendar.getYear();	    // Returns year
var amonth = Calendar.getMonth();   // Returns month (0-11)
var today = Calendar.getDate();     // Returns day (1-31)
var weekday = Calendar.getDay();    // Returns day of week (1-7)

var DAYS_OF_WEEK = 7;               // "constant" for number of days in a week
var DAYS_OF_MONTH = 31;             // "constant" for number of days in a month
var cal;                            // Used for printing

Calendar.setDate(1);                // Start the calendar day at '1'
Calendar.setMonth(month);           // Start the calendar month
Calendar.setYear(year);             // Start the calendar year

cal = '<table bgcolor=#CCCCCC cellpadding=0 cellspacing=0 border=0><tr><td>';
cal += '<table bgcolor=#CCCCCC cellpadding=0 cellspacing=1 border=0 width=100%>';
cal += '<tr bgcolor=#6699CC>';
cal += '<td align=center colspan=7 height=20><font color=#FFFFFF><b>';
cal += month_of_year[month] + ' ' + year;
cal += '</b></font></td>';
cal += '</tr>';
cal += '<tr bgcolor=#E0E0E0>';

// print a day of week
for(index=0; index < DAYS_OF_WEEK; index++)
{
  cal += '<td align=center width=30>';
  // bold today's day of week
  if ((weekday == index) && (amonth == Calendar.getMonth()))
    cal += '<B>' + day_of_week[index] + '</B>';
  else
    cal += day_of_week[index];
  cal += '</td>';
}
cal += '</tr>';
cal += '<tr bgcolor=#FFFFFF>';

// fill blank before today
if (Calendar.getDay() > 0) {
  for(index=0; index < Calendar.getDay(); index++)
  cal += '<td align=center></td>';
}

// loop for each day
for(index=0; index < DAYS_OF_MONTH; index++)
{
if (Calendar.getDate() > index)
{
  // to check for first day of week
  week_day = Calendar.getDay();

  // start new row
  if ((week_day == 0) && (Calendar.getDate() > 1))
  cal += '<tr bgcolor=#FFFFFF>';

  if (week_day != DAYS_OF_WEEK)
  {

  // SET VARIABLE INSIDE LOOP FOR INCREMENTING PURPOSES
  var day  = Calendar.getDate();

  cal += '<td align=center>';
  if ((today == Calendar.getDate()) && (amonth == Calendar.getMonth()) && (ayear == Calendar.getYear()))
    // HIGHLIGHT TODAY'S DATE
    cal += '<B>' + day + '</B>';
  else
    cal += day;
    
  }
  cal += '</td>';

  // end row for last day of week
  if (week_day == DAYS_OF_WEEK)
    cal += '</tr>';
  
  }

  // INCREMENTS UNTIL END OF THE MONTH
  Calendar.setDate(Calendar.getDate()+1);

}// end for loop

if (week_day < DAYS_OF_WEEK - 1)
{
  // fill the blank until last day of week
  for (index = week_day+1; index < DAYS_OF_WEEK; index++)
    cal += '<td align=center></td>';
  cal += '</tr>';
}

cal += '</table></td></tr></table>';

return cal;
}

// PRINT CALENDAR
//document.write(cal);

// End -->
